#include "visit.h"


Ret_visit_funcOrVarDef* visit_funcOrVarDef(ASTNode* node, SymbolTable* s, Module* m, BasicBlock* bb) {
    Ret_visit_funcOrVarDef* ret = new Ret_visit_funcOrVarDef();
    
    if (!node){
        variant<int, float, string> res;
        res = 0;
        ret -> res = res;
        ret -> is_funcDef = false;
        
        return ret;
    }

    ASTNode* child = node->children[0];
    if (child->type == "argVarDef") {
        // 处理变量定义
        variant<int, float, string> res = visit_argVarDef(child, s, m, bb);
        visit_argVarDecl(node, s, bb);
        ret -> res = res;
        ret -> is_funcDef = false;

        return ret;

    } else if (child->type == "funcDef") {
        // 处理函数定义
        ret -> is_funcDef = true;
        ret -> res = 0;
        
        return ret;
    } 
}